package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entity.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @Author lizhilong
 * @create 2020/4/29 22:07
 * @desc
 */
@Slf4j
@RestController
public class OrderController {

    public static final String url_prefix = "http://consul-provider-payment";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/payment/consul")
    public CommonResult<String> paymentConsul() {
        CommonResult commonResult = restTemplate.getForObject(url_prefix + "/payment/consul", CommonResult.class);
        return commonResult;
    }

}
